import request from '@/utils/request'

//  任务管理
export function listPage(params) {
  return request({
    url: '/task/listPage',
    method: 'get',
    params
  })
}

export function list(params) {
  return request({
    url: '/task/list',
    method: 'get',
    params
  })
}

export function save(data) {
  return request({
    url: `/task/add`,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: `/task/update`,
    method: 'post',
    data
  })
}

export function del(id, group) {
  return request({
    url: `/task/delete`,
    method: 'delete',
    params: { id: id, group: group }
  })
}


// 计划
export function listPlanPage(params) {
  return request({
    url: '/task/listPlanPage',
    method: 'get',
    params
  })
}

export function listPlan(params) {
  return request({
    url: '/task/listPlan',
    method: 'get',
    params
  })
}

export function addPlan(data) {
  return request({
    url: `/task/addPlan`,
    method: 'post',
    data
  })
}

export function updatePlan(data) {
  return request({
    url: `/task/updatePlan`,
    method: 'post',
    data
  })
}

export function delPlan(id, group) {
  return request({
    url: `/task/delPlan`,
    method: 'delete',
    params: { id: id, group: group }
  })
}

export function pausePlan(id, group) {
  return request({
    url: `/task/pausePlan`,
    method: 'get',
    params: { id: id, group: group }
  })
}

export function startPlan(id, group) {
  return request({
    url: `/task/startPlan`,
    method: 'get',
    params: { id: id, group: group }
  })
}
